/*!
 * CodeGenerator(https://git.oschina.net/ptma/CodeGenerator)
 *
 * Date: 2019-08-15 10:06:31
 */
package com.azier.influxdb.model;

import lombok.Getter;
import lombok.Setter;
import org.influxdb.annotation.Column;
import org.influxdb.annotation.Measurement;

import java.time.Instant;
import java.util.Date;

/**
 * Table: monitoring_stats_data_influxdb -  <br/>
 *
 * @author 金建强(ptma@163.com)
 * @version 2019-08-15 10:06:31
 */
@Getter
@Setter
@Measurement(name = "monitoringStatsDataInfluxdb",database = "seem")
public class MonitoringStatsDataInfluxdb extends BaseInfluxModel {

    @Column(name = "tenantId",tag = true)
    private String tenantId;

    @Column(name = "deviceId",tag = true)
    private String deviceId;

    @Column(name = "monitoringCode",tag = true)
    private String monitoringCode;

    @Column(name = "areaCode",tag = true)
    private String areaCode;

    @Column(name = "stationId",tag = true)
    private String stationId;

    @Column(name = "smCode",tag = true)
    private String smCode;

    @Column(name = "advStationEquipmentId",tag = true)
    private String advStationEquipmentId;

    @Column(name = "indexId",tag = true)
    private String indexId;

    @Column(name = "equipmentSequence",tag = true)
    private String equipmentSequence;

    @Column(name = "monitoringSequence",tag = true)
    private String monitoringSequence;

    @Column(name = "tempId",tag = true)
    private String tempId;

    @Column(name = "valueType",tag = true)
    private String valueType;

    @Column(name = "dataType",tag = true)
    private String dataType;

    @Column(name = "processType",tag = true)
    private String processType;

    @Column(name = "value")
    private Double value;

    @Column(name = "time")
    private Instant time;

    /**
     * 获取当前时区的时间
     * @return
     */
    public Date getDate() {
        if (time==null) {
            return null;
        }
        Date date = new Date(time.toEpochMilli());
        return date;
    }
    /**
     * 以当前的时间设置Instant时间
     * @return
     */
    public void setDate(Date date) {
        Instant instant = Instant.ofEpochMilli(date.getTime());
        this.time = instant;
    }

}
